package PenTest.meituan.acm0406;

import java.util.Scanner;
import java.util.*;
public class acm4 {
    static final int mod = (int)1e9 + 7;

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        HashMap<Character, Long> rec1 = new HashMap<>();
        String s = scanner.next();
        for (char c : s.toCharArray()) {
            rec1.put(c, 1L);
        }
        while (--n > 0) {
            HashMap<Character, Long> rec2 = new HashMap<>();
            String t = scanner.next();
            for (char c : t.toCharArray()) {
                for (Map.Entry<Character, Long> p : rec1.entrySet()) {
                    if (p.getKey() != c) {
                        rec2.put(c, (rec2.getOrDefault(c, 0L) + p.getValue()) % mod);
                    }
                }
            }
            rec1 = rec2;
        }
        long ans = 0;
        for (Map.Entry<Character, Long> p : rec1.entrySet()) {
            ans = (ans + p.getValue()) % mod;
        }
        System.out.println(ans);
    }
}
